<template class="theme1">
  <div class="theme1">
    <el-row :gutter="20">
      <el-col :span="18" class="theme">
        <el-row :gutter="10">
          <el-col :span="24">
            <div class="grid-content bg-purple big" style="background-color: #fff;box-shadow: rgba(0, 0, 0, 0.098) 0px 0px 10px;">
              <div id="com-page" :class="[fullScreenStatus.map ? 'fullscreen' : '']">
                <single-map ref="map"></single-map>
                <div class="resize">
                  <!-- <span @click="changeSize('map')" :class="['iconfont',fullScreenStatus.rank? 'icon-compress-alt': 'icon-expand-alt',]"></span> -->
                </div>
              </div>
            </div>
          </el-col>
        </el-row>
        <el-row :gutter="10" style="margin-top: -10px;">
          <el-col :span="8">
            <div class="grid-content bg-purple line-chart">
              <div id="com-page">
                <Trend></Trend>
              </div>
            </div>
          </el-col>
          <el-col :span="8">
            <div class="grid-content bg-purple cylindrical">
              <div id="com-page" :class="[fullScreenStatus.rank ? 'fullscreen' : '']">
                <Rank ref="rank"></Rank>
                <div class="resize">
                  <!-- <span @click="changeSize('rank')" :class="['iconfont',fullScreenStatus.rank? 'icon-compress-alt': 'icon-expand-alt',]"></span> -->
                </div>
              </div>
            </div>
          </el-col>
          <el-col :span="8" style="border-radius: 10px;">
            <div class="grid-content line-chart">
              <div id="com-page">
                <Seller></Seller>
              </div>
            </div>
          </el-col>
        </el-row>
      </el-col>
      <el-col :span="6" style="background-color: #fff;text-align: center;border-radius: 10px;box-shadow: rgba(0, 0, 0, 0.098) 0px 0px 10px;"> 
        <div style="width:100%;margin-top: 40px;" > 
          <img src="./../../../public/img/1.png" alt="" width="250px">
        </div>
        <div style="margin-top: 42px;">
          <span style="font-size: 20px; font-weight: bold; ">{{username}}</span><br>
          <!-- <div style="font-size: 16px; color: #999999;margin-top: 10px;">管理员</div> -->
        </div>
        <div style="margin-top: 60px;">
          <el-calendar 
            v-model="value">
          </el-calendar>
        </div>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import Seller from "./Seller.vue";
import Trend from "./Trend.vue";
import Map from "@/components/hy/Map.vue";
import Rank from "@/components/hy/Rank";

export default {
  components: {
    Seller,
    "single-map": Map,
    Trend,
    Rank,
  },

  data() {
    return {
      username:'',
       value: new Date(),
      //定义每一个图表得全屏状态
      fullScreenStatus: {
        map: false,
        rank: false,
        seller: false,
        trend: false,
      },
    };
  },
  methods: {
    changeSize(chartName) {
      // 1.改变fullScreenStatus的数据
      this.fullScreenStatus[chartName] = !this.fullScreenStatus[chartName];
      // 2.需要调用每一个图表组件的screenAdapter的方法
      // this.$refs[chartName].screenAdapter()
      this.$nextTick(() => {
        this.$refs[chartName].screenAdapter();
      });
    },
  },
  mounted() {
    this.getLoadEcharts();
  },
  methods: {
    getLoadEcharts() {
      var myChart = this.$echarts.init(document.getElementById("echart"));
      var colorList = ["#4FE894", "#EF0C27", "#FEE7EA"];
      var listData = [
        { name: "不明", value: 20 },
        { name: "已判明", value: 20 },
        { name: "未发现", value: 20 },
      ];
      var option = {
        color: colorList,
        title: {
          x: "center",
          y: "center",
          textStyle: {
            color: "#000",
            fontSize: 20,
          },
        },
        legend: {
          orient: "vertical",
          bottom: 5,
          align: "right",
          right: 15,
          textStyle: {
            color: "#000",
            fontSize: 20,
          },
          selectedMode: false,
          data: ["元素1", "元素2", "元素3"],
        },
        tooltip: {
          trigger: "item",
        },
        series: [
          {
            type: "pie",
            center: ["50%", "50%"],
            radius: ["55%", "35%"],
            itemStyle: {
              normal: {
                color: function (params) {
                  return colorList[params.dataIndex];
                },
              },
            },
            label: {
              show: true,
              fontSize: 10,
              color: "#000",
              formatter: function (data) {
                return data.name + ":" + data.percent.toFixed(0) + "%";
              },
            },
            labelLine: {
              normal: {
                length: 15,
                length2: 15,
                lineStyle: {
                  width: 2,
                },
              },
            },
            data: listData,
          },
        ],
      };
      myChart.setOption(option);
    },
  },
  created(){
    this.username = JSON.parse(sessionStorage.getItem("username"));
  }
};
</script>

<style  scoped>
.transparent {
  background-color: rgba(255, 255, 255, 0.5);
}
.el-row {
  margin-bottom: 20px;
}
.el-col {
  border-radius: 4px;
}
.bg-purple-dark {
  background: #ffffff;
}
.bg-purple {
  background: #ffffff;
}
.bg-purple-light {
  background: #e5e9f2;
}
.grid-content {
  border-radius: 10px;
  min-height: 36px;
  height: 610px;
  color: black;
  position: relative;
}
.row-bg {
  padding: 10px 0;
  background-color: #f9fafc;
}

.middle {
  height: 264px;
  border-radius: 10px;
  background-color: #ffffff;
  box-shadow: rgba(0, 0, 0, 0.198) 0px 0px 10px;
}
.resize {
  position: absolute;
  right: 20px;
  top: 20px;
  cursor: pointer;
}
.fullscreen {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  z-index: 100;
}

.line-chart {
  width: 100%;
  height: 260px;
  border-radius: 10px;
  background-color: #fff;
}

.cylindrical{
  height: 260px;
  border-radius: 10px;
  border-radius: 100px;
  box-shadow: rgba(0, 0, 0, 0.098) 0px 0px 10px;
  background-color: #fff;
}
.el-calendar-table .el-calendar-day {
        height: 200px;
      }
.el-calendar-table thead th:before{
    content: '星期';
}
.el-calendar-table tbody tr:last-child{
    display: none !important; 
}
.theme{
  padding-left:0px;
  padding-top: -10px;
}    

</style>